﻿using UnityEngine;

namespace UnityView
{
    public struct Frame
    {
        public float x;
        public float y;
        public float width;
        public float height;

        public Vector2 Origin => new Vector2(x, y);
        public Vector2 Size => new Vector2(width, height);

        public Frame(Vector2 origin, Vector2 size)
        {
            x = origin.x;
            y = origin.y;
            width = size.x;
            height = size.y;
        }

        public Frame(float x, float y, float width, float height)
        {
            this.x = x;
            this.y = y;
            this.width = width;
            this.height = height;
        }

        public static Frame Zero => new Frame(0, 0, 0, 0);
    }

    public struct Frame3D
    {
        public Vector3 Position;
        public Vector2 Size;

        public Frame3D(Vector3 position, Vector2 size)
        {
            Position = position;
            Size = size;
        }

        public Frame3D(Vector3 position, float width, float height)
        {
            Position = position;
            Size = new Vector2(width, height);
        }

        public Frame3D(float x, float y, float z, float width, float height)
        {
            Position = new Vector3(x, y, z);
            Size = new Vector2(width, height);
        }
    }

    public struct UIFrame
    {
        public float x;
        public float y;
        public float width;
        public float height;

        public Vector2 Origin => new Vector2(x, y);
        public Vector2 Size => new Vector2(width, height);

        public UIFrame(Vector2 origin, Vector2 size)
        {
            x = origin.x;
            y = origin.y;
            width = size.x;
            height = size.y;
        }

        public UIFrame(float x, float y, float width, float height)
        {
            this.x = x;
            this.y = y;
            this.width = width;
            this.height = height;
        }
    }
}